package com.ruoyi.rcpt.kjry.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.echarts.EChartsBt;
import com.ruoyi.rcpt.kjry.service.IKjryService;
import com.ruoyi.rcpt.kjry.vo.RcLyVo;
import com.ruoyi.rcpt.kjry.vo.RysVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/rcpt")
public class RcptController {

    @Resource
    private IKjryService kjryService;

    /**
     * 人品平台首页 人员数
     * @return 结果
     */
    @GetMapping("/getRys")
    public AjaxResult getRys() {

        List<EChartsBt> result = new ArrayList<>();

        RysVo rysVo = kjryService.getRys();

        EChartsBt eChartsBt1 = new EChartsBt();
        eChartsBt1.setName("管理人员");
        eChartsBt1.setValue(rysVo.getGlRy());
        result.add(eChartsBt1);

        //result.add(new EChartsBt("管理人员", rysVo.getGlRy())); //简化写法

        EChartsBt eChartsBt2 = new EChartsBt();
        eChartsBt2.setName("外聘技术人员");
        eChartsBt2.setValue(rysVo.getWpJsRy());
        result.add(eChartsBt2);

        EChartsBt eChartsBt3 = new EChartsBt();
        eChartsBt3.setName("外聘研发人员");
        eChartsBt3.setValue(rysVo.getWpYfRy());
        result.add(eChartsBt3);

        EChartsBt eChartsBt4 = new EChartsBt();
        eChartsBt4.setName("技术人员");
        eChartsBt4.setValue(rysVo.getJsRy());
        result.add(eChartsBt4);

        EChartsBt eChartsBt5 = new EChartsBt();
        eChartsBt5.setName("研发人员");
        eChartsBt5.setValue(rysVo.getYfRy());
        result.add(eChartsBt5);

        EChartsBt eChartsBt6 = new EChartsBt();
        eChartsBt6.setName("拔尖人才");
        eChartsBt6.setValue(rysVo.getBjRc());
        result.add(eChartsBt6);

        EChartsBt eChartsBt7 = new EChartsBt();
        eChartsBt7.setName("专业技术带头人");
        eChartsBt7.setValue(rysVo.getZyJsDtr());
        result.add(eChartsBt7);

        EChartsBt eChartsBt8 = new EChartsBt();
        eChartsBt8.setName("辅助人员");
        eChartsBt8.setValue(rysVo.getFzRy());
        result.add(eChartsBt8);

        return AjaxResult.success(result);
    }

    /**
     * 人品平台首页 人才领域
     * @return 结果
     */
    @GetMapping("/getRcLy")
    public AjaxResult getRcLy() {

        List<EChartsBt> result = new ArrayList<>();

        RcLyVo rcLyVo = kjryService.getRcLy();

        result.add(new EChartsBt("公用与民用建筑", rcLyVo.getGyYMyJz()));
        result.add(new EChartsBt("装备制造", rcLyVo.getZbZz()));
        result.add(new EChartsBt("房屋建筑", rcLyVo.getFwJz()));
        result.add(new EChartsBt("其他领域", rcLyVo.getQtLy()));
        result.add(new EChartsBt("工程管理", rcLyVo.getGcGl()));
        result.add(new EChartsBt("电子电气", rcLyVo.getDzDq()));
        result.add(new EChartsBt("绿色矿山", rcLyVo.getLsKs()));
        result.add(new EChartsBt("水电水利", rcLyVo.getSdSl()));
        result.add(new EChartsBt("公路与市政", rcLyVo.getGlYSz()));
        result.add(new EChartsBt("水资源与环境", rcLyVo.getSzyYHj()));
        result.add(new EChartsBt("土木工程", rcLyVo.getTmGc()));
        result.add(new EChartsBt("轨道交通", rcLyVo.getGdJt()));

        return AjaxResult.success(result);
    }

}
